package main

import "fmt"

type Person struct {
	name   string
	age    int
	gender int
}

type long int

func (l long) name() {
	fmt.Println("l =", l)
}

type myStr string

func (c myStr) name() {
	fmt.Println("c =", c)
}

// 获取Person信息
func (person Person) getPersonInfo() {
	fmt.Println("person =", person)
}

// 修改Person信息 --> 需要传入指针
func (person *Person) setPersonInfo(name string, age int, gender int) {
	person.name = name
	person.age = age
	person.gender = gender
}

func main() {
	p1 := Person{"nick", 10, 'm'}
	p1.getPersonInfo() // person = {nick 10 109}

	var p2 Person
	p2.setPersonInfo("alfo", 20, 'w')
	p2.getPersonInfo() // person = {alfo 20 119}

	var l long = 1
	l.name()

	var c myStr = "abc"
	c.name()
}
